package com.block.risk.factory;

import com.block.common.util.ApplicationContextUtil;
import com.block.risk.service.IDefaultItemService;
import com.block.risk.service.type.item.*;

import java.util.HashMap;
import java.util.Map;

public class DefaultItemFactory {

    private static Map<String, Class<? extends IDefaultItemService>> serviceMap = new HashMap<>();
    static {
        serviceMap.put("321_SPECIAL", YuJuItemService.class);

        serviceMap.put("146_SPECIAL", YiShengItemService.class);
        serviceMap.put("150_SPECIAL", JuKaiItemService.class);
        serviceMap.put("166_SPECIAL", JiaAiNuoItemService.class);
        serviceMap.put("168_SPECIAL", XingChenItemService.class);
        serviceMap.put("171_SPECIAL", XingYiItemService.class);
        serviceMap.put("175_SPECIAL", NianJinTiItemService.class);
        serviceMap.put("173_SPECIAL", ChuangDeItemService.class);
        serviceMap.put("189_SPECIAL", BiaoLuoItemService.class);
        serviceMap.put("184_SPECIAL", XinNianItemService.class);

        serviceMap.put("192_SPECIAL", LiangYanItemService.class);
        serviceMap.put("223_SPECIAL", ChuangDeItemService.class);
        serviceMap.put("26_FORM", ZaiYangItemService.class);
        serviceMap.put("188_SPECIAL", JuJiuItemService.class);
        serviceMap.put("258_SPECIAL", ChuangDeItemService.class);
        serviceMap.put("260_SPECIAL", RuiFuTeItemService.class);
        serviceMap.put("270_SPECIAL", SenGuanItemService.class);
        serviceMap.put("279_SPECIAL", BenLeiItemService.class);
        serviceMap.put("231_SPECIAL", ZhongYangXingItemService.class);
        serviceMap.put("320_SPECIAL", ZaiYangItemService.class);
        serviceMap.put("340_SPECIAL", JiuRunItemService.class);

    }

    public static IDefaultItemService getService(String filterKey){
        if (serviceMap.containsKey(filterKey)){
            Class<? extends IDefaultItemService> aClass = serviceMap.get(filterKey);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }
}
